//
//  LbtWebView.m
//  A段项目
//
//  Created by dllo on 16/2/25.
//  Copyright © 2016年 Scott. All rights reserved.
//

#import "LbtWebView.h"
#import <MBProgressHUD.h>

@interface LbtWebView () <UIWebViewDelegate>

@end

@implementation LbtWebView

- (void)dealloc {
    
    self.webView.delegate = nil;
    [_webView release];
    
    [super dealloc];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    self.webView = [[UIWebView alloc] initWithFrame:self.view.frame];
    
    self.webView.allowsLinkPreview = YES;
    
    self.webView.delegate = self;
    
    [self.view addSubview:self.webView];
    [MBProgressHUD showHUDAddedTo:self.webView animated:YES];
    dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
       
        
        [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.link]]];
        
        
        
        
        dispatch_async(dispatch_get_main_queue(), ^{
            
        });
    });

}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    
    
    [MBProgressHUD hideHUDForView:self.webView animated:YES];
    
}

- (void)viewDidDisappear:(BOOL)animated {
    
    [self.webView removeFromSuperview];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
